#!/bin/bash

# Check user if root
user=`whoami`
if [ "$whoami" != "root" ]; then
   echo "This script requires root permissions to run"
   exit 1
fi

# Stop Tomcat
/etc/init.d/tomcat6 stop

# Wiping the Alfresco repo
if [ -d /var/lib/alfresco/alf_data ]; then
  rm -rf /var/lib/alfresco/alf_data/
fi
cat drop-database.sql | mysql -u root -palfresco
cat create-database.sql | mysql -u root -palfresco

